padding
The padding property adds space around the content of a view, mirroring the behavior of SwiftUI’s padding modifier. It helps separate a view from surrounding elements and improve layout clarity.
Definition
Supported Formats
You can specify padding in multiple ways:
1. Default Padding
Applies the system default padding on all sides.
Example:
2. Uniform Padding
Applies the same number of points of padding to all edges.
Example:
3. Directional Padding Object
Specify individual edges or edge groups.
Supported Keys:
Each value can be a number or true. When set to true, it applies the default system padding for that edge.
Example:
Example with true for specific edges:
Notes
- Padding does not affect the size of the view’s content directly, but adjusts the space around it.
- Combining directional keys allows for precise control over layout spacing.
horizontal/verticalandleading/trailingcan be combined. The more specific key (likeleading) overrides the group key (likehorizontal) if both are provided.
